<!--
  * 枚举标签组件
  *
  * @Author:    1024创新实验室-主任：卓大
  * @Date:      2024-01-01 00:00:00
  * @Wechat:    zhuda1024
  * @Email:     lab1024@163.com
  * @Copyright  1024创新实验室 （ https://1024lab.net ），Since 2012
-->
<template>
  <span>{{ enumDesc }}</span>
</template>

<script setup>
  import { computed, getCurrentInstance } from 'vue';

  const props = defineProps({
    /**
     * 枚举名称
     */
    enumName: {
      type: String,
      required: true,
    },
    /**
     * 枚举值
     */
    value: {
      type: [String, Number, Boolean],
      required: true,
    },
  });

  const { proxy } = getCurrentInstance();

  /**
   * 获取枚举描述
   */
  const enumDesc = computed(() => {
    return proxy.$smartEnumPlugin.getDescByValue(props.enumName, props.value) || props.value;
  });
</script> 